<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.czp.framework.util.HttpUtils" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
	String contextPath = request.getContextPath();
	String jsPath = contextPath + "/js";
	String jqueryPath = jsPath + "/jquery";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>用户登录</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<style type="text/css">
			body {
				background: black;
			}
			.formsInput {
				width: 150px;
				/*background: url(#) no-repeat;
				color: White;*/
			}
			label {
				color: #A1DAF9;
				font-size: 12px;
			}
		</style>
		<script type="text/javascript" src="<%=jqueryPath%>/jquery-1.7.1.min.js"></script>
		<script type="text/javascript">
			<%//如果已登录过，Session存在则跳入
				if(HttpUtils.getSession("userId") != null 
						&& !HttpUtils.getSession("userId").equals("")) {
			%>
				window.open('<%=contextPath%>/jsp/index.jsp','_top');
			<% } %>
			function yz() {
				var username = $('#username').val();
				var password = $('#password').val();
				if(username == "") {
					$('#info').html("用户名不可为空");
					return false;
				} else if(password == "") {
					$('#info').html("密码不可为空");
					return false;
				} else {
					$.post(
						"<%=contextPath%>/UserAction!login.do",
						{"username": username, "password": password},
						function(result){
							if(result == 0) {
								$('#info').html("用户名或密码错误!");
							} else if(result == 2) {
								$("#info").html("用户已被禁用!");
							} else {
								location.href = "<%=contextPath%>/jsp/index.jsp";
							}
						}
					);
				}
			}
		</script>
	</head>
	<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0"
		marginheight="0">
		<table id="table" width="1000" height="600" border="0" cellpadding="0"
			cellspacing="0" align="center">
			<tr>
				<td colspan="3" background="images/LOGIN_01.jpg"
					style="width: 1000; height: 225;"></td>
			</tr>
			<tr>
				<td rowspan="2" background="images/LOGIN_02.jpg"
					style="width: 353; height: 375;"></td>
				<td align="center" background="images/LOGIN_03.jpg"
					style="width: 301; height: 196;">
					<br />
					<form id="form" action="<%=contextPath%>/login.do" method="post">
						<label>用户名：</label>
						<input class="formsInput" type="text" id="username" name="user.username" />
						<br /><br />
						<label>密&emsp;码：</label>
						<input class="formsInput" type="password" id="password" name="user.password" />
						<br />
						<span id="info" style="color: red; font-size: 12px;"></span>
						<br />
						<input type="button" value="登录" onclick="yz();"/>
					</form>
				</td>
				<td rowspan="2" background="images/LOGIN_04.jpg"
					style="width: 346; height: 375;"></td>
			</tr>
			<tr>
				<td background="images/LOGIN_05.jpg" style="width: 301; height: 179"></td>
			</tr>
		</table>
	</body>
</html>